/*
 * @Author: jqgao2
 * @Date: 2022-11-15 09:53:03
 * @LastEditTime: 2022-11-17 14:04:23
 * @Description:
 * @FilePath: \cucc-front\vite.config.ts
 * @LastEditors: jqgao2
 */
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";
import viteCompression from "vite-plugin-compression";
// import postcsspxtovw from "postcss-px-to-viewport";

// https://vitejs.dev/config/
// 配置 gzip 压缩 https://gitcode.net/mirrors/anncwb/vite-plugin-compression/-/blob/main/README.zh_CN.md
export default defineConfig({
  plugins: [
    vue(),
    viteCompression({
      threshold: 1024 * 5, // 大于5kb 压缩
    }),
  ],
  resolve: {
    //设置路径别名
    alias: {
      "@": path.resolve(__dirname, "./src"),
      "*": path.resolve(""),
    },
  },
  server: {
    // 开发服务器配置
    port: 5134,
    host: true,
    // open: true,
    proxy: {
      "^/xcx/api/.*": {
        target: "http://10.5.163.226:10015",
        changeOrigin: true,
      },
    },
  },
});
